//
//  DengLuViewController.m
//  ForengnMenu
//
//  Created by @-@ on 16/1/20.
//  Copyright © 2016年 余旺. All rights reserved.
//

#import "DengLuViewController.h"

@interface DengLuViewController ()

@end

@implementation DengLuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
    
    button.frame = CGRectMake(0, 0, 60, 30);
    
    [button setTitle:@"<返回" forState:UIControlStateNormal];
    
    [button addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];

    
    UILabel * l = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 40)];
    l.text = @"登陆";
    l.textAlignment = NSTextAlignmentCenter;
    l.textColor = [UIColor whiteColor];
    self.navigationItem.titleView = l;
    
    
    
    self.BGImageView.image = [UIImage imageNamed:@"Icon_DengLuBg.png"];
    
    self.dengLuTextField.placeholder = @"账号:";
    [self.dengLuTextField setValue:[UIColor colorWithWhite:0.7 alpha:1.0] forKeyPath:@"_placeholderLabel.textColor"];
    
    self.passwordTextField.placeholder = @"密码:";
    [self.passwordTextField
     setValue:[UIColor colorWithWhite:0.7 alpha:1.0] forKeyPath:@"_placeholderLabel.textColor"];
    
    //轻敲手势
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(forgetAction)];
    
    //设置手指数量
    tap.numberOfTouchesRequired = 1;
    
    //设置触摸次数
    tap.numberOfTapsRequired = 1;
    
    self.forgetPassLabel.userInteractionEnabled = YES;
    
    [self.forgetPassLabel addGestureRecognizer:tap];

}

-(void)forgetAction{

    [self performSegueWithIdentifier:@"showForget" sender:nil];
    
}

//返回
- (void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}

//触摸结束时触发收起键盘
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [self.view endEditing:YES];
    
}

//视图将要出现时
-(void)viewWillAppear:(BOOL)animated{
    //让导航栏透明
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    
    //让分割线透明
    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
    
    
}



- (IBAction)zhuCeAction:(id)sender {
    
    
}



- (IBAction)dengLuAction:(id)sender {
    
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
